"use strict";
cc._RF.push(module, '28e0fiVp9BNy7v1THY3QQ+u', 'itemmove');
// script/itemmove.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var GlobalData_1 = require("./GlobalData");
// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var itemmove = /** @class */ (function (_super) {
    __extends(itemmove, _super);
    function itemmove() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    itemmove.prototype.start = function () {
        //y高度范围 -200~-800, x范围 1700~1900
        // let y = Math.random() * 600 + 150, x=Math.random() * 200 + 1700
        // this.node.y = -y;
        // this.node.x = 2300;
        // cc.tween(item).repeatForever(status).start();  
    };
    itemmove.prototype.init = function () {
        var _this = this;
        var posx = this.node.x;
        var time = Math.floor(Math.random() * 10 + 15);
        var delay_time = Math.random() * 2000 + 1000;
        cc.tween(this.node).to((posx + 2300) / 100, { x: -2300 }).call(function () {
            _this.repartmove();
        }).start(), this;
    };
    itemmove.prototype.repartmove = function () {
        var _this = this;
        var y = Math.random() * 600 + 150, x = Math.random() * 200 + 1700;
        this.node.y = -y;
        this.node.x = 2300;
        var delay_time = Math.random() * 2000 + 1000;
        cc.tween(this.node).to(50, { x: -2300 }).call(function () {
            _this.repartmove();
        }).start(), this;
    };
    itemmove.prototype.clickEvent = function () {
        this.node.active = false;
        //id 跟 title 自定义属性
        var data = { id: this.node.id, title: this.node.title };
        GlobalData_1.default.gameData.push(data);
        GlobalData_1.default.sum++;
        console.log(GlobalData_1.default.gameData);
        console.log(GlobalData_1.default.sum);
    };
    itemmove = __decorate([
        ccclass
    ], itemmove);
    return itemmove;
}(cc.Component));
exports.default = itemmove;

cc._RF.pop();